//
//  ViewController2.swift
//  PingTransition
//
//  Created by tianqi on 2017/11/9.
//  Copyright © 2017年 david.com. All rights reserved.
//

import UIKit

class ViewController2: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        navigationController?.delegate = self
    }

    
    @IBAction func btnAction(btn: Any) {
        
        navigationController?.popViewController(animated: true)
    }
    
    deinit {
        print(#line)
    }
}

extension ViewController2: UINavigationControllerDelegate {
    
    func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        
        if operation == UINavigationControllerOperation.pop {
            return PingInvertTransation()
        }
        return nil
    }
}

